Ext.define('Admin.view.employee.EmployeeGridPanel', {
    extend: 'Ext.grid.Panel',
    xtype: 'employeeGridPanel',
    id:'employeeGridPanel',
      
    requires: [
      //'Ext.grid.column.RowNumberer',
      'Ext.selection.CheckboxModel'
    ],
    title: '用户列表',
    //store: Ext.data.StoreManager.lookup('simpsonsStore'),
  bind: '{employeeDataList}',
  listeners: {
        //celldblclick : 'openEmployeeWindow',
        itemmouseenter:'employeeTip'
    },
  selModel: {
    selType: 'checkboxmodel',
        checkOnly: true,
        showHeaderCheckbox: true
    },
    //multiSelect: true,
     dockedItems: [{
        xtype: 'toolbar',
        items: [{
          xtype: 'combobox',
          fieldLabel: '',
          name: 'searchFieldName',
          reference:'searchFieldName',
          store: {
              proxy: {
                  type: 'memory',
                  reader: 'array'
              },
              fields: [ 'key', 'value'],
              data: [
                  ['员工名', 'empName'],
                  ['用户名', 'userName']
              ]
          },
          queryMode: 'local',
          displayField: 'key',
          valueField: 'value',
          value:'empName',
          editable: false,
          allowBlank: false
      },'-',{
            xtype: 'textfield',
            name:'searchFieldValue',
            id:'employeeSearchFieldValue',
            reference:'searchFieldValue'
        },'-',{
            text:'快捷查询',
            tooltip:'快捷查询',
            iconCls:'x-fa fa-search',
            handler : 'search'
        },'-',{
            text:'高级查询',
            tooltip:'高级查询',
            iconCls:'x-fa fa-search-plus',
            handler : 'openMoreSearchWindow'
        }]
    }],
    columns: [
        //{xtype: 'rownumberer',width: 40, sortable: false},
        
         
     { header: 'ID',  dataIndex: 'empId',hiden:true },
         { header: '真实姓名',  dataIndex: 'empName' },
         { header: '用户名',  dataIndex: 'user.userName' },
         { header: '性别',  dataIndex: 'sex',width:80},
         { header: '岗位',  dataIndex: 'post.postName' },
         { header: '所属部门', dataIndex: 'post.part.partName', flex: 1 },
         { header: '入职时间',  dataIndex: 'joinTime' ,flex: 1 ,renderer: Ext.util.Format.dateRenderer('Y/m/d') }
    ,{
            xtype: 'actioncolumn',
            items: [{
            xtype: 'button',
                iconCls: 'x-fa fa-pencil',
                handler : 'openEditWindow'
            },{
                xtype: 'button',
                iconCls: 'x-fa fa-trash',
                handler : 'deleteEmployee'
            }],
            cls: 'content-column',
            width: 120,
            //dataIndex: 'bool',
            text: '操作',
            tooltip: '操作 '
          }],
    columnLines: true,
  bbar: {
      xtype: 'pagingtoolbar',//注意以后MVVM中使用新写法,不要使用Ext.create()
        //store: Ext.data.StoreManager.lookup('simpsonsStore'),
        bind: '{employeeDataList}',
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
        items:[
            '-', {
            text: '批量删除',
            listeners: {
          click:'deleteEmployees'
      }
        },{
            text: '添加员工',
            listeners: {
                click:'openAddWindow'
            }
        }]
    }
});